<#assign base=request.contextPath />
<#assign oneLabel="系统管理">

<#assign twoLabel="资源管理">
<#assign twoUrl=base+"/resources/list">

<#if resourcesDO?? && (resourcesDO.id)!=0>
	<#assign leafLabel="新增资源">
	<#else>
	<#assign leafLabel="新增资源">
</#if>
<!DOCTYPE html>
<html lang="en">
<head>
	<link rel="stylesheet" href="${base}/static/assets/css/chosen.css" />
	<#include "/commons/headImport.ftl">
</head>
<body>
<#include "/commons/header.ftl">
<form class="form-horizontal" name="formName" method="post">
<div class="row">
	<div class="col-xs-12">
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">父资源</label>
			<div class="col-sm-4">
				<select class="width-100 chosen-select" name="pid">
					<option value="0">根目录</option>
					<#if resourcesTree??>
						<#list resourcesTree as res>
							<option value="${res.id}" <#if res.id == resourcesDO.pid>selected</#if>>${res.name}</option>
							<#if res.children??>
							<#list res.children as children>
								<option value="${children.id}" <#if children.id == resourcesDO.pid>selected</#if>>&nbsp;&nbsp;&nbsp;&nbsp;${children.name}</option>
								<#if children.children??>
								<#list children.children as child>
									<option value="${child.id}" <#if child.id == resourcesDO.pid>selected</#if>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${child.name}</option>
								</#list>
								</#if>
							</#list>
							</#if>
						</#list>
					</#if>
				</select>
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red"> 
				<#if resourcesDO??>  
				    <@spring.bind "resourcesDO.pid" />
				    <@spring.showErrors "<br>"/>
				</#if>
			</div>										
		</div>
		<div class="space-4"></div>

		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">
				名称<span class="red">*</span>
			</label>
			<div class="col-sm-4">
				<input type="text" name="name" value="${resourcesDO.name!''}" class="col-sm-12" />
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red"> 
				<#if resourcesDO??>  
				    <@spring.bind "resourcesDO.name" />
				    <@spring.showErrors "<br>"/>
				</#if>
			</div>										
		</div>
		<div class="space-4"></div>
			
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">路径</label>
			<div class="col-sm-4">
				<input type="text" name="paths" value="${resourcesDO.paths!''}" class="col-xs-10 col-sm-12" />
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red"> 
				<#if resourcesDO??>
				    <@spring.bind "resourcesDO.paths" />
				    <@spring.showErrors "<br>"/>
				</#if>
			</div>										
		</div>
		<div class="space-4"></div>
			
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">序号</label>
			<div class="col-sm-4 ace-spinner" style="width: 90px;">
				<input type="text" name="sort" value="${resourcesDO.sort!0}" class="input-mini" id="spinner1" />
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red"> 
				<#if resourcesDO??>
				    <@spring.bind "resourcesDO.sort" />
				    <@spring.showErrors "<br>"/>
				</#if>
			</div>										
		</div>
		<div class="space-4"></div>
			
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">类型</label>
			<div class="col-sm-4">
				<label>
					<input name="type" <#if resourcesDO.type == 10>checked</#if> type="radio" value="10" class="ace" />
					<span class="lbl">菜单</span>
				</label>
				<label>
					<input name="type" <#if resourcesDO.type == 20>checked</#if> type="radio" value="20" class="ace" />
					<span class="lbl">功能</span>
				</label>
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red"> 
				<#if resourcesDO??>  
				    <@spring.bind "resourcesDO.type" />
				    <@spring.showErrors "<br>"/>
				</#if>
			</div>
		</div>
		<div class="space-4"></div>
			
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">是否叶子</label>
			<div class="col-sm-4">
				<label>
					<input name="leaf" <#if resourcesDO.leaf == 0>checked</#if> type="radio" value="0" class="ace" />
					<span class="lbl">否</span>
				</label>
				<label>
					<input name="leaf" <#if resourcesDO.leaf == 1>checked</#if> type="radio" value="1" class="ace" />
					<span class="lbl">是</span>
				</label>
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red"> 
				<#if resourcesDO??>  
				    <@spring.bind "resourcesDO.leaf" />
				    <@spring.showErrors "<br>"/>
				</#if>
			</div>										
		</div>
	</div><!-- /.col -->
</div><!-- /.row -->
<input name="id" type="hidden" value="${resourcesDO.id}"/>
<input type="hidden" name="json" value='${json}'/>
</form>

<div class="hr hr32 hr-dotted"></div>

<div class="clearfix">
	<div class="col-md-offset-2 col-md-9">
		<button class="btn btn-xs btn-info" type="button" id="save_id"
			url="<#if resourcesDO??&&resourcesDO.id!=0>${base}/resources/edit<#else>${base}/resources/add</#if>">
			<i class="icon-save bigger-110"></i>保存
		</button>
		<button class="btn btn-xs return_class" type="button" url="${base}/resources/list">
			<i class="icon-reply bigger-110"></i>返回
		</button>
	</div>
</div>

<#include "/commons/footer.ftl">
<script src="${base}/static/assets/js/chosen.jquery.min.js"></script>
<script src="${base}/static/assets/js/fuelux/fuelux.spinner.min.js"></script>
<script src="${base}/static/assets/js/jquery.inputlimiter.1.3.1.min.js"></script>
<script src="${base}/static/assets/js/jquery.maskedinput.min.js"></script>
<!-- inline scripts related to this page -->
<script type="text/javascript">
	jQuery(function($) {
	   $('#spinner1').ace_spinner({
	   		value:$('#spinner1').val(),min:0,max:200,step:1, btn_up_class:'btn-info' , btn_down_class:'btn-info'
	   	})
		
		$(".chosen-select").chosen();
	});
</script>
</body>
</html>
